/*****************************************************************************************
 **  Author:jxx 2022
 **  QQ:283591387
 **完整文档见：http://v2.volcore.xyz/document/api 【代码生成页面ViewGrid】
 **常用示例见：http://v2.volcore.xyz/document/vueDev
 **后台操作见：http://v2.volcore.xyz/document/netCoreDev
 *****************************************************************************************/
//此js文件是用来自定义扩展业务代码，可以扩展一些自定义页面或者重新配置生成的代码
// import modelHeader from "../delivery_request/delivery_request.vue"
import modelBody from "../sales_contract/salesContract.vue";
// import modelFooter from "../sales_contract_mx/salesContractMx.vue";
// import modelFooter from "../sales_contract_inventory/salesContractInventory.vue";//张师傅定义的视图
import modelFooter from "../unsold/unsold.vue"; //自己重写的视图
import modelHeader from "../../inventoryinfo/goods_inventory_warehouse_xm/goodsInventoryWarehouse_xm.vue";
import gridHeader from "@/components/print/selectTemplet.vue"
import {
  mapMutations
} from "vuex";

let extension = {
  components: {
    //查询界面扩展组件
    gridHeader,
    gridBody: '',
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: modelHeader,
    modelBody: modelBody,
    modelFooter: modelFooter
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: {
    view: [],
    box: [],
    detail: []
  }, //扩展的按钮
  methods: {
    ...mapMutations(
      ("salesContractMX", ["storeRemoveForm", "storeChangeForm"])
    ),
    //下面这些方法可以保留也可以删除
    async onInit() {
      this.queryFields = ["Voucher_sub", "CreateDate"]
      let startTime = this.base.getOneWeekAgoDate()
      let endTime = this.base.getDate(false) + " 23:59:59"
      this.searchFormFields.CreateDate = [startTime, endTime]
      this.textInline = false
      this.detailOptions.textInline = false
      this.editFormOptions.forEach(x => {
        x.forEach(item => {
          if (item.field == 'Attachment' || item.field == 'Image') {
            item.multiple = true;
            item.maxFile = 10;
          }
        })
      })
      if (this.$route.path == "/q_sales" && JSON.stringify(this.$route.query) != '{}') {
        console.log("触发查询")
        await this.base.setSearchParamFn(this)
        // this.searchFormFields.Voucher_sub = null
        // this.searchFormFields.AuditStatus = null
        // this.searchFormFields.Goods_num = [null, null]
        // this.searchFormFields.CreateDate = [null, null]
        // const selectList = ['CreateDate',"AuditStatus"]
        // this.searchFormOptions.forEach(item => {
        //   item.forEach(x => {
        //     if (selectList.includes(x.field)) {
        //       x.onChange = (v) => {
        //         this.$route.query = {}
        //       }
        //     }
        //   })
        // })

        setTimeout(() => {
          this.refresh()
        })
      }
    },
    async onInited() {
      if (this.$route.path != "/q_sales") {
        this.setFiexdSearchForm(true);
        this.height = 550 - 150;
        this.buttons.forEach(item => {
          if (item.value != "Search") {
            item.hidden = true
          }
        })
        this.boxButtons[0].hidden = true
      }
      this.detailOptions.columns.forEach(item => {
        if (item.field == "WHSE_name") {
          item.filter = false
          item.onChange = (e) => {
            console.log("库位变化", e)
            if (e.WHSE_name && e.Goods_sub) {
              console.log("发送请求")
              try {
                const url = `api/q_goods_inventory_warehouse_xm/GetAvailableQuantity?kw=${e.WHSE_name}&&Goods_sub=${e.Goods_sub}`
                this.http.post(url, {}, "").then(reslut => {
                  console.log("reslut", typeof reslut)
                  if (reslut == 0) {
                    e.AvailableQuantity = 0
                  } else if (typeof reslut == "object") {
                    if (reslut[0].ID) {
                      e.AvailableQuantity = reslut[0].可用数量
                      e.Inventory_ID = reslut[0].ID
                      if (e.AvailableQuantity < e.Goods_num) {
                        this.base.ElMessageFn(`${e.Goods_name}销售数量大于库存可用数量`)
                      }
                    }
                  }
                })
              } catch (error) {
                console.error(error)
              }
            }
          }
        }
      })
      if (this.$route.path != "/q_sales") {
        this.searchFormFields.AuditStatus = "1"
      }
      this.textInline = false
      this.single = true

      // await this.setFiexdSearchForm(true);
      // await this.buttons.forEach(item => {
      //   if (item.name == "高级查询") {
      //     item.hidden = true
      //   }
      // })
      await this.detailOptions.buttons.splice(this.detailOptions.buttons.findIndex(item => item.name == "添加行"), 1)
      // await this.detailOptions.buttons.splice(this.detailOptions.buttons.findIndex(item => item.name == "删除行"), 1)
      await this.detailOptions.buttons.splice(this.detailOptions.buttons.findIndex(item => item.name == "导入"), 1)
      // this.detailOptions.buttons.unshift({
      //   name: "选择合同商品", //按钮名称
      //   icon: 'el-icon-plus', //按钮图标，参照iview图标
      //   type: 'primary',
      //   plain: true,
      //   onClick: function () { //触发事件
      //     if (!this.editFormFields.Sales_contract_voucher_sub) {
      //       this.base.ElMessageFn("请先选择销售合同")
      //       return
      //     }
      //     if (this.rowschild) {
      //       this.rowschild.click()
      //     }
      //     // this.$refs.modelFooter.open(this.editFormFields.Sales_contract_id, this.editFormFields.Sales_contract_voucher_sub)
      //     let form = {
      //       合同: this.editFormFields.Sales_contract_voucher_sub,
      //     }
      //     this.storeChangeForm(form);
      //     this.$refs.modelFooter.open(this.editFormFields.Sales_contract_voucher_sub)
      //     this.$store.commit("setTabelText", true)
      //   }
      // })
      this.detailOptions.buttons.unshift({
        name: "选择商品", //按钮名称
        icon: 'el-icon-plus', //按钮图标，参照iview图标
        type: 'primary',
        plain: true,
        onClick: function () { //触发事件
          if (this.rowschild) {
            this.rowschild.click()
          }
          if (!this.editFormFields.WHSE_no) {
            this.base.ElMessageFn("请先选择销售机构")
            return false;
          }
          this.$refs.modelHeader.open(this.editFormFields.WHSE_no)
          this.$store.commit("setTabelText", true)
        }
      })


     

    },
    WHSE_IdDisableFn(off) {
      //选择商品
      if (!off) {
        this.detailOptions.columns.forEach(item => {
          if ((item.field == "Goods_num" || item.field == "Goods_price")) {
            item.edit = {
              type: "number"
            }
          }
        })
        this.editFormOptions.forEach(item => {
          item.forEach(x => {
            if (x.field == 'WHSE_no') {
              x.disabled = true
            }
          })
        })
        return;
      }
      //选择销售合同
      // this.detailOptions.columns.forEach(item => {
      //   if ((item.field == "Goods_num" || item.field == "Goods_price")) {
      //     item.edit = null
      //   }
      // })
      // this.editFormOptions.forEach(item => {
      //   item.forEach(x => {
      //     if (x.field == 'WHSE_no' || x.field == 'Tax_rate') {
      //       x.disabled = true
      //     }
      //   })
      // })
      // this.detailOptions.buttons.splice(this.detailOptions.buttons.findIndex(item => item.name == "删除行"), 1)
      // this.detailOptions.buttons.splice(this.detailOptions.buttons.findIndex(item => item.name == "选择商品"), 1)
    },
    async searchBefore(param) {
      //界面查询前,可以给param.wheres添加查询参数
      //返回false，则不会执行查询
      if (this.$route.path != "/q_sales") {
        param.wheres = param.wheres.filter(item => item.name != "Sales")
        this.$route.query = {}
      }
      if (this.$route.path == "/q_sales" && JSON.stringify(this.$route.query) != '{}') {
        await this.base.setSearchBefore(this, "Sales", param)
        // const sectionState = ["[null,null]",JSON.stringify(["",null]),JSON.stringify([null,""]),JSON.stringify(["",""])]
        // const numState=sectionState.includes(JSON.stringify(this.searchFormFields.Goods_num))
        // const dateState=sectionState.includes(JSON.stringify(this.searchFormFields.CreateDate))
        // if (this.searchFormFields.Voucher_sub ||!numState ||!dateState) {
        //    param.wheres=param.wheres.filter(item=>item.name!="Sales")
        //   this.$route.query = {}
        // }
      }
      return true;
    },
    searchAfter(result) {
      //查询后，result返回的查询数据,可以在显示到表格前处理表格的值
      // this.base.proNumRegBefore(result, "", "Goods_num")
      return true;
    },
    delBefore(ids, rows) { //查询界面的表删除前 ids为删除的id数组,rows删除的行
      let auditStatus = rows.some(x => x.AuditStatus != 0);
      if (auditStatus) {
        this.base.ElMessageFn('只能删除待审核数据')
        return false;
      }
      return true;
    },
    rowClick({
      row,
      column,
      event
    }) {
      //查询界面点击行事件
      this.$refs.table.$refs.table.toggleRowSelection(row);
    },
    async addBeforeAsync(formData) {
      console.log("formData", formData)
      this.storeRemoveForm()
      return this.testAdd(formData)
    },
    async updateBeforeAsync(formData) {
      this.storeRemoveForm()
      //编辑保存前formData为对象，包括明细表、删除行的Id
      return this.testAdd(formData)
    },
    detailRowClick({
      row,
      column,
      event
    }) {
      this.$refs.detail.$refs.table.toggleRowSelection(row);
      if (this.$route.path != "/q_sales" || this.rowAuditStatus != 0) {
        return
      }; //|| !this.CreateUserBoole
      // if ((column.property == "Goods_num" || column.property == "Goods_price") && this.editFormFields.Sales_contract_voucher_sub) {
      //   return;
      // }
      if (column.property == "Goods_num" || column.property == "Goods_price" || column.property == "Remark"|| column.property == "SN") {
        let dom = event.target
        if (dom.nodeName != "SPAN") {
          setTimeout(() => {
            let inpDom = dom.querySelector("input")
            inpDom.focus()
          }, 0)
        }
      }
    },
    delDetailRow(rows) { //弹出框删除明细表的行数据(只是对table操作，并没有操作后台)
      try {
        if (rows.length == this.$refs.detail.rowData.length) {
          this.$store.commit("setWHSE_time", true)
          this.$store.commit("setWHSE_disabled", true)
          this.WHSE_Interval = setInterval(() => {
            console.log("WHSE_Interval", this.WHSE_Interval)
            this.editFormOptions.forEach(item => {
              item.forEach(x => {
                if (x.field == 'WHSE_no') {
                  if (this.$store.state.WHSE_disabled) {
                    x.disabled = true
                  } else {
                    if (this.editFormFields.Sales_contract_voucher_sub) {
                      x.disabled = true
                    } else {
                      x.disabled = false
                    }
                  }
                }
              })
            })
            if (!this.$store.state.WHSE_time) {
              clearInterval(this.WHSE_Interval)
              console.log("WHSE_Interval清除", this.WHSE_Interval)
            }
          }, 500)

        }
      } catch {
        console.log("删除catch", )
      }
      return true;
    },
    onModelClose(iconClick) {
      //iconClick=true为点击左中上角X触发的关闭事件
      //如果返回 false不会关闭弹出框 
      //return false;
      this.storeRemoveForm()
      this.$store.commit("setTabelText", true)
      this.boxModel = false;
    },
    async modelOpenBefore(row) {
      this.$store.commit("setTabelText", false)
      this.CreateUserBoole = row.CreateID == this.$store.state.userID
      this.rowAuditStatus = await row.AuditStatus
      if (JSON.stringify(row) == "{}") {
        this.rowAuditStatus = 0
        this.CreateUserBoole = true
      }
      if (this.$route.path != "/q_sales" || this.rowAuditStatus != 0) { // || !this.CreateUserBoole
        this.boxButtons[0].hidden = true
        this.detailOptions.buttons.forEach(item => {
          if (item.name != "导出" && item.name != "刷新") {
            item.hidden = true
          }
        })
      } else {
        this.boxButtons[0].hidden = false
        this.detailOptions.buttons.forEach(item => item.hidden = false)
      }
    },
    modelOpenAfter(row) {
      console.log("this.currentAction", this.currentAction)
      // if (this.currentAction == "add") {
      //   this.detailOptions.columns.forEach(item => {
      //     if ((item.field == "Goods_num" || item.field == "Goods_price") && !this.editFormFields.Sales_contract_voucher_sub) {
      //       item.edit = {
      //         type: "number"
      //       }
      //     }
      //   })
      // }
      // this.detailOptions.columns.forEach(item => {
      //   if ((item.field == "Goods_num" || item.field == "Goods_price") && this.editFormFields.Sales_contract_voucher_sub) {
      //     item.edit = null
      //   } else if ((item.field == "Goods_num" || item.field == "Goods_price") && !this.editFormFields.Sales_contract_voucher_sub) {
      //     item.edit = {
      //       type: "number"
      //     }
      //   }
      // })
      //明细表点击表格时触发编辑方法
      this.detailOptions.beginEdit = (row, column, index) => {
        if (!this.editFormFields.WHSE_no) {
          this.base.ElMessageFn("请先选择销售机构")
          return false;
        }
        if (this.$route.path != "/q_sales" || this.rowAuditStatus != 0) { //|| !this.CreateUserBoole
          return false
        }
        this.detailOptions.columns.forEach(item => {
          if (item.field == "WHSE_name") {
            if (!row.Goods_sub) {
              return
            }
            this.base.getWHSEName(item, row.Goods_sub, false, this.editFormFields.WHSE_no)
          }
        })
        // if (!this.editFormFields.Sales_contract_voucher_sub) {
        let rows = document.querySelectorAll(".grid-detail .el-table__body .el-table__row")
        this.rowschild = rows[0].childNodes[3]
        setTimeout(() => {
          // 销售数量
          let testInputDom = rows[index].querySelectorAll("td")[7].querySelector("input")
          testInputDom.addEventListener("keyup", (e) => {
            if (+e.target.value > +row.AvailableQuantity) {
              this.base.ElMessageFn("销售数量大于可用数量")
            }
            if (e.target.value === "" || row.Goods_price === "") {
              row.Total_price = ""
              row.Tax_exclusive_contract_total_price = ""
              row.Cost_price_total_price = ""
              row.Tax_exclusive_total_price = ""
              return
            }
            if ((typeof + row.Goods_price) == "number" && !(+row.Goods_price) && row.Goods_price != "" && row.Goods_price != 0) {
              return this.base.ElMessageFn("请正确输入销售单价")
            }
            // if (+row.Goods_price <= 0 && row.Goods_price) {
            //   return this.base.ElMessageFn("销售单价请大于零")
            // }

            if (!(+e.target.value > 0 && +e.target.value)) {
              row.Total_price = ""
              row.Tax_exclusive_contract_total_price = ""
              row.Cost_price_total_price = ""
              row.Tax_exclusive_total_price = ""
              this.base.ElMessageFn("销售数量请填写有效正数")
              return;
            }
            if (!this.editFormFields.Tax_rate) {
              row.Total_price = row.Goods_price * e.target.value
              row.Cost_price_total_price = this.base.roundToFourDecimals(e.target.value * row.Cost_price)
              row.Tax_exclusive_total_price = this.base.roundToFourDecimals(e.target.value * row.Tax_exclusive)
              return;
            }
            try {
              let num1 = row.Goods_price * e.target.value
              let num2 = this.base.roundToFourDecimals((row.Goods_price) / (1 + +this.editFormFields.Tax_rate)) * e.target.value
              row.Total_price = this.base.roundToFourDecimals(num1)
              row.Tax_exclusive_contract_total_price = this.base.roundToFourDecimals(num2)
              row.Cost_price_total_price = this.base.roundToFourDecimals(e.target.value * row.Cost_price)
              row.Tax_exclusive_total_price = this.base.roundToFourDecimals(e.target.value * row.Tax_exclusive)
            } catch (error) {
              console.error(error)
            }

          })
          // 销售单价
          let testInputDom2 = rows[index].querySelectorAll("td")[8].querySelector("input")
          testInputDom2.addEventListener("keyup", (e) => {

            if (e.target.value === "" || row.Goods_num === "") {
              row.Total_price = ""
              row.Tax_exclusive_contract_total_price = ""

              return
            }
            if ((typeof + row.Goods_num) == "number" && !(+row.Goods_num) && row.Goods_num != "" && row.Goods_num != 0) {
              return this.base.ElMessageFn("请正确输入销售数量")
            }
            if (+row.Goods_num <= 0 && row.Goods_num) {
              return this.base.ElMessageFn("销售数量请大于零")
            }

            if (!+e.target.value && +e.target.value != 0) {
              row.Total_price = ""
              row.Tax_exclusive_contract_total_price = ""

              this.base.ElMessageFn("请正确输入销售单价")
              return;
            }
            if (!this.editFormFields.Tax_rate) {
              row.Total_price = row.Goods_num * e.target.value
              return;
            }
            let num1 = row.Goods_num * e.target.value
            let num2 = this.base.roundToFourDecimals((row.Goods_num) / (1 + +this.editFormFields.Tax_rate)) * e.target.value
            row.Total_price = this.base.roundToFourDecimals(num1)
            row.Tax_exclusive_contract_total_price = this.base.roundToFourDecimals(num2)

          })
        }, 0)
        // }

        return true
      }
      console.log(this.editFormOptions);

      this.editFormOptions.forEach(item => {
        item.forEach(x => {
          // if (this.currentAction == "Add") {
          if (x.field == "Install_status") {
            x.data.forEach(d => {
              if (d.key != 0 && d.key != 3) {
                d.hidden = true
              } else {
                d.hidden = false
              }
            })
          }
          // }


          if (x.field == "Tax_rate") {
            x.onChange = (e) => {
              console.log("税率变化")
              let detailDate = this.$refs.detail.rowData
              detailDate.forEach(d => {
                if (d.Goods_price > 0 && d.Goods_num > 0) {
                  const num = this.base.roundToFourDecimals(d.Goods_price / (1 + +e))
                  console.log("num", num)
                  d.Tax_exclusive_contract_total_price = this.base.roundToFourDecimals((num * d.Goods_num))
                }
              })
            }
          }
          if (x.field == "Install_service") {
            x.onChange = (e) => {
              console.log("安装服务变化", e)
              if (e === "0") {
                this.editFormFields.Install_status = "0"

              } else {
                this.editFormFields.Install_status = "3"
              }
              // if()

            }
          }
          if (x.field == "Client") {
            x.onChange = () => {
              console.log("客户变化")
              if (this.editFormFields.Sales_contract_voucher_sub) {
                this.editFormFields.Sales_contract_voucher_sub = ''
                this.editFormFields.Goods_num = ''
                this.editFormFields.Total_price = ''
                this.editFormFields.Tax_rate = ''
                this.editFormFields.WHSE_no = ''
                this.$refs.detail.rowData = []
              }
            }
          }
          if (x.field == "WHSE_no") {
            x.onChange = () => {
              console.log("销售机构变化")
              if (this.rowschild) {
                this.rowschild.click()
              }
              this.$refs.detail.rowData = []
              // this.$refs.detail.rowData.forEach(item => {
              //   item.WHSE_name = ""
              //   item.AvailableQuantity = ""
              // })
            }
          }
          if (x.field == "Sales_contract_id" || x.field == "Zhibao_state") {
            try {
              x.hidden = true
            } catch (error) {
              console.error(error);
            }
          }
          if (x.field == "Voucher_sub" || x.field == "Goods_num" || x.field == "Total_price" || x.field == "Sales_contract_voucher_sub"|| x.field == "Install_status") {
            x.disabled = true
            if (x.field == "Sales_contract_voucher_sub") {
              if (this.currentAction == "update") {
                x.extra = null
              } else {
                x.remote = true
                x.extra = {
                  icon: "el-icon-zoom-in",
                  text: "选择销售合同",
                  style: "color:#3a8ee6;font-size:13px;cursor:default",
                  click: () => {
                    if (!this.editFormFields.Client) {
                      this.base.ElMessageFn("请先选择客户")
                      return
                    }
                    if (!this.$refs.detail.rowData.length) {
                      this.$refs.modelBody.open(true, this.editFormFields.Client)
                      this.$store.commit("setTabelText", true)
                    } else {
                      this.base.ElMessageFn("存在销售单明细，不允许更改销售合同编码");
                    }
                  }
                }
              }

            }
          } else {
            x.disabled = false
          }
          if ((x.field == "WHSE_no" || x.field == "Client" || x.field == "Tax_rate") && this.currentAction == "update") {
            x.disabled = true
          }
          if (x.field == "Tax_rate" && this.editFormFields.Sales_contract_voucher_sub) {
            x.disabled = true
          }
          if (this.$route.path != "/q_sales" || this.rowAuditStatus != 0) { //|| !this.CreateUserBoole
            if (x.field == "Sales_contract_voucher_sub") {
              x.extra = null
            }
            x.disabled = true
          }
        })
      })
    },
    async testAdd(formData) {
      if(this.currentAction=="Add"){
        formData.mainData.Goods_num=0
        formData.mainData.Total_price=0
      }
      if (!this.$refs.detail.rowData.length) {
        this.base.ElMessageFn('明细表不可为空', "error")
        return false
      }
      if (!this.editFormFields.WHSE_no) {
        this.base.ElMessageFn('请选择销售机构')
        return false
      }
      if (!this.editFormFields.Tax_rate) {
        this.base.ElMessageFn('请选择销售税率')
        return false
      }
      if (!this.editFormFields.Zhibao_date) {
        this.base.ElMessageFn("请选择质保截至时间")
        return false;
      }
      if (!this.editFormFields.Install_service) {
        this.base.ElMessageFn("请选择安装服务")
        return false;
      }
      if (!this.editFormFields.Install_status) {
        this.base.ElMessageFn("请选择安装状态")
        return false;
      }
     
      if (!this.editFormFields.Project_name) {
        this.base.ElMessageFn("请填写项目名称")
        return false;
      }
      formData.mainData.Zhibao_state = this.editFormFields.Zhibao_date > this.base.getDate(true) ? 1 : 0
      let boole1 = formData.detailData.some(item => item.Goods_num === "" || item.Goods_num === null || item.Goods_num === undefined)
      if (boole1) {
        this.base.ElMessageFn("明细表中请填写销售数量")
        return false;
      }
      let boole22 = formData.detailData.some(item => +item.Goods_num === 0 && (item.Goods_num != "" || item.Goods_num != null || item.Goods_num == undefined))
      if (boole22) {
        this.base.ElMessageFn("明细表中销售数量不可为零或空")
        return false;
      }
      let boole3 = formData.detailData.every(item => +item.Goods_num > 0 && +item.Goods_num)
      if (!boole3) {
        this.base.ElMessageFn("明细表中销售数量请填写有效正数")
        return false;
      }
      // let boole11 = formData.detailData.some(item => item.Goods_price === "" || item.Goods_price === null || item.Goods_price === undefined)
      // if (boole11) {
      //   this.base.ElMessageFn("明细表中请填写销售单价")
      //   return false;
      // }
      // let boole222 = formData.detailData.some(item => +item.Goods_price === 0 && (item.Goods_price != "" || item.Goods_price != null || item.Goods_price == undefined))
      // if (boole222) {
      //   this.base.ElMessageFn("明细表中销售单价不可为零或空")
      //   return false;
      // }
      // let boole33 = formData.detailData.every(item => +item.Goods_price > 0 && +item.Goods_price)
      // if (!boole33) {
      //   this.base.ElMessageFn("明细表中销售单价请填写有效正数")
      //   return false;
      // }
      let boole11 = formData.detailData.some(item => item.Goods_price === "" || item.Goods_price === null || item.Goods_price === undefined)
      if (boole11) {
        this.base.ElMessageFn("明细表中请填写单价")
        return false;
      }
      // let boole22 = formData.detailData.some(item => +item.Goods_price === 0&&(item.Goods_price!=""||item.Goods_price!=null|| item.Goods_price == undefined))
      // if (boole22) {
      //   this.base.ElMessageFn("明细表中单价不可为空")
      //   return false;
      // }
      let boole23 = formData.detailData.every(item => item.Goods_price !== "" || item.Goods_price !== null || item.Goods_price === undefined || item.Goods_price ? ("" + item.Goods_price).trim() !== "" : +item.Goods_price)
      if (!boole23) {
        this.base.ElMessageFn("明细表中单价不可为空")
        return false;
      }
      let boole33 = formData.detailData.every(item => +item.Goods_price >= 0)
      if (!boole33) {
        this.base.ElMessageFn("明细表中单价请填写有效正数")
        return false;
      }

      let boole = formData.detailData.every(item => item.WHSE_name)
      let boole2 = formData.detailData.every(item => +item.AvailableQuantity >= +item.Goods_num)
      // let booleP2 = formData.detailData.every(item => +item.Goods_price == true || +item.Goods_price > 0)
      if (!boole) {
        this.base.ElMessageFn("销售单明细中请选择库位")
        return false;
      }
      if (!boole2) {
        this.base.ElMessageFn("销售单明细中销售数量不可大于可用数量")
        return false;
      }
      return true
    },
  }
};
export default extension;